<?php
	include_once("../include/init.php");
	include_once("admin_init.php");
	$sql = "SELECT * FROM  tk_product_category";
	$res = mysql_query($sql);
	$info = [];
	if(mysql_num_rows($res)>0){
		while($list=mysql_fetch_assoc($res)){
			$info[]=$list;
		}
	}
		$info = get_cate($info);	
	$tr = "tr_";
	$time = time();
	$bh = $tr.Date("Ymd").rand(1000,9999);


?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主体部分</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
<style>
#c1{
	width:20px;
	height:20px;
	background:black;
	display:inline-block;
}
#c2{
	width:20px;
	height:20px;
	background:pink;
	display:inline-block ;
}

}
</style>
</head>
<body leftmargin="8" topmargin='8'>
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' colspan="2"><span><img src='skin/images/frame/arr3.gif' style='margin-right:10px;'>添加商品</span></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>
    	<form action="product.php" method="post" enctype="multipart/form-data" >
		<table style="margin-bottom:8px;margin-top:8px;margin-left:20px;">
			<tr>
				<td>商品名称:</td>
				<td><input type="text" name="pname" value="" /></td>
			</tr>
			 <tr>
				<td width="100px;">商品分类:</td>
				
				<td><select name="parent_id">
				<option value="0">品牌</option>
					<?php foreach($info as $k=>$v){?>
			<option value="<?= $v['cate_id'] ?>"><?= $v['cate_name']?></option>
		<?php } ?></select></td>
			  </tr>
			   <tr>
					<td>商品编号:</td>
					<td><input type="text" name="pnums" value="<?= $bh ;?>" /></td>
			   </tr>
			    <tr>
					<td>发表时间:</td>
					<td><input type="text" name="pubtime" value="<?= $time ;?>" /></td>
			   </tr>
			    <tr>
					<td>价格:</td>
					<td><input type="text" name="price" value="" /></td>
			   </tr>
			    <tr>
					<td>优惠价格:</td>
					<td><input type="text" name="sprice" value="" /></td>
			   </tr>
			    <tr>
					<td>颜色:</td>
					<td><input type="checkbox" name="color[]" value="black" /><div id="c1"></div>
						<input type="checkbox" name="color[]" value="pink" /><div id="c2"></div>
					</td>
			   </tr>
			    <tr>
					<td>尺码:</td>
					<td><input type="checkbox" name="size[]" value="32G" />32G
						<input type="checkbox" name="size[]" value="64G" />64G
						<input type="checkbox" name="size[]" value="128G" />128G
						<input type="checkbox" name="size[]" value="246G" />246G
					</td>
			   </tr>
			    <tr>
					<td>库存:</td>
					<td><input type="text" name="snums" value="" /></td>
			   </tr>
			    <tr>
					<td>地址:</td>
					<td><input type="text" name="addr" value="" /></td>
			   </tr>
			   <tr>
				 <td>是否上架</td>
				 <td><input type="radio" name="show" value="1"<?= isset($v['ifshow'])=="1"?'checked':''?>>上架 <input type="radio" name="show" value="0"<?= isset($v['ifshow'])=="0"?'checked':''?>>下架</td>
			   </tr>
			    <tr>
					<td>标题图片:</td>
					<td><input type="file" name="files" value="" /></td>
			   </tr>
			    <tr>
					<td>商品图片:</td>
					<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
					<td><input type="file" name="movefiles[]" value="" multiple/></td>
			   </tr>
			    <tr>
					<td>商品描述:</td>
					<td>	<?php
								include_once("./fckeditor/fckeditor.php");
								$fckeditor = new FCKeditor("content");//定义默认值 name
								$fckeditor->Width = "300px";//定义编辑器的宽度
								$fckeditor->Height = "200px";//定义编辑器的高度
								$fckeditor->Value = "";//定义默认值
								$fckeditor->BasePath='./fckeditor/';
								$fckeditor->ToolbarSet = "Basic";
								$fckeditor->Create();//创建编辑器
							?>
					</td>
			   </tr>
			   <tr>
			   		<input type="hidden" name="act" value="add" />
				 <td colspan="2" align="center" height="40px"><input type="submit" name="sub" value=" 添加 " class="coolbt2"></td>
			   </tr>
		</table>
	</form>
	</td>
  </tr>
</table>
</body>
</html>